/**
 * 产品修改js
 */
var comValidform=null;
var returnStatus=false;
var activityAdd={
	activityUE:null,
		
	startEvent:function(){
		$("#recordTab ul").idTabs();
		
		comValidform=$(".com-addForm").Validform({

			datatype:{
				"m0-2" : /^[0-9]+(.[0-9]{1,2})?$/
			},
			tiptype:2,
			tipSweep:true,


			beforeSubmit:function(curform){
				$("#loading")
					.ajaxStart(function(){
						$(this).show();
					})//开始上传文件时显示一个图片
					.ajaxComplete(function(){
						$(this).hide();
					});//文件上传完成将图片隐藏起来

				var url = 'mgr/activityCtrl/save';
				var params = jsUtils.serializeJson($('.com-addForm'));

				if(params.channel == undefined || params.channel == null){
					alert("请至少选择一个发布渠道！");
					return false
				}else{
					params.channel = params.channel.toString();
				}

				params.creator = userId;

				var cb = function(data){
					alert(data.msg);
					//成功返回
					if(data.resultCode==200){
						//关闭窗口并刷新数据
						returnStatus=true;
					}
				};
				sendApiNoLoadSync(url, params, cb, 'POST');
				return false;
			}
		});
	},
	
	init:function(){
		activityAdd.startEvent();
	}
}
$(document).ready(function() {
	activityAdd.init();
});
function submitForm(){
	comValidform.submitForm();
	return returnStatus;
}